<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
    <style>
        html,
        body,
        #container {
            width: 100%;
            height: 100%;
        }
    </style>
    <title>GeoJSON</title>
    <link rel="stylesheet" href="//a.amap.com/jsapi_demos/static/demo-center/css/demo-center.css" />
    <script src="https://webapi.amap.com/maps?v=1.4.15&key=6e79f6d236e295632f21b385e363b6e8"></script>
    <script src="https://a.amap.com/jsapi_demos/static/demo-center/js/demoutils.js"></script>
</head>
<body>
<div id="container"></div>
<script src="./zjPark84.js"></script>
<script type="text/javascript">
    var map = new AMap.Map('container', {
        resizeEnable: true, //是否监控地图容器尺寸变化
        mapStyle: "amap://styles/whitesmoke",
        zoom: 12, //初始地图级别
        center: [121.634055, 31.219888], //初始地图中心点
    });

    var geojson = new AMap.GeoJSON({
        geoJSON: geoJSON,
        // 还可以自定义getMarker和getPolyline
        getPolygon: function(geojson, lnglats) {
            // 计算面积
            var area = AMap.GeometryUtil.ringArea(lnglats[0])

            return new AMap.Polygon({
                path: lnglats,
                fillOpacity: 1 - Math.sqrt(area / 8000000000),// 面积越大透明度越高
                strokeColor: 'rgba(0, 139, 210, 0.9)',
                fillColor: 'transparent',
                strokeStyle: 'dashed',
            });
        }
    });

    geojson.setMap(map);
</script>
</body>
</html>
